﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace Ruanmou.SOA.Web.Remote
{
    /// <summary>
    /// MyWebService 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务，请取消注释以下行。 
    // [System.Web.Script.Services.ScriptService]
    public class MyWebService : System.Web.Services.WebService
    {

        [WebMethod]
        public string HelloWorld()
        {
            return "Hello World";
        }
        [WebMethod]
        public List<UserInfo> GetUserList()
        {
            return new List<UserInfo>
            {
                new UserInfo
                {
                    Id = "123",
                    Name = "一路有你",
                    Age = "23"
                },
                new UserInfo
                {
                    Id = "32",
                    Name = "仙仙试试",
                    Age = "24"
                }
            };
        }
        [WebMethod]
        public string GetName(string id)
        {
            return JsonConvert.SerializeObject(new UserInfo
            {
                Id = "123",
                Name = "一路有你",
                Age = "23"
            });
        }
    }
}
